package LeetCode;

public class No153 {
    public static void main(String[] args) {
        int[] a = {3,4,5,1,2};
        System.out.println(findMin(a));
    }
    public static int findMin(int[] nums) {
        int n = nums.length-1;
        int left = 0,right=n;
        while(left<right){
            int mid =(left+right)/2;
            if(nums[mid]>=nums[n]){
                left=mid+1;
            }else{
                right=mid;
            }
        }
        return nums[right];
    }
}
